package com.ywwxhz.fragments;

import android.os.Bundle;

import com.ywwxhz.data.ListDataProvider;
import com.ywwxhz.data.impl.NetNewsListDataProvider;
import com.ywwxhz.entitys.TopicItem;
import com.ywwxhz.inter.HttpCallback;
import com.ywwxhz.lib.kits.NetKit;

/**
 * Created by Steven Hua on 2017/3/3.
 */

public class MainNewsListFragment extends BaseNewsListFragment {
    private TopicItem item;

    @Override
    protected ListDataProvider getProvider() {
        Bundle bundle = getArguments();
        item = (TopicItem) bundle.getSerializable("item");
        return new NetNewsListDataProvider(getActivity()) {
            @Override
            public String getTypeKey() {
                return item.getTopicId();
            }

            @Override
            public String getTypeName() {
                return item.getTopicName();
            }

            @Override
            public void makeRequest(int page, String type, HttpCallback handlerInterface) {
                NetKit.getInstance().getNewslistByTopic(page, type, handlerInterface);
            }

            @Override
            public int getPageSize() {
                return 40;
            }
        };
    }

    @Override
    public boolean hasMenu() {
        return true;
    }
}